﻿using FrameWorkSong;
using UnityEngine;

public class CameraMovePos : MonoBehaviour
{
    public Vector3 CameraPos;
    public bool isMove = false;
    void Update()
    {
        if (isMove)
        {
            Camera.main.transform.position = Vector3.MoveTowards(Camera.main.transform.position, CameraPos, 30f * Time.deltaTime);
            if (Camera.main.transform.position == CameraPos)
            {
                isMove = false;
            }
        }
    }

    private void OnMouseDown()
    {
        //CameraPos = Camera.main.GetCameraMovePos(gameObject.GetComponent<MeshFilter>().mesh.bounds);
        CameraPos = Camera.main.GetCameraMovePos(gameObject.GetComponent<Collider>().bounds);
        isMove = true;
    }
}
